//
//  CYYHelpViewController.m
//  LetsParty
//
//  Created by YG on 15/9/27.
//  Copyright (c) 2015年 LetsPartyTeam. All rights reserved.
//

#import "CYYHelpViewController.h"

@interface CYYHelpViewController ()

@property (nonatomic, strong) UIScrollView * guidScrollView;
//@property (nonatomic, strong) NSMutableArray * labelArray;
//@property (nonatomic, strong) NSMutableArray * imageArray;

- (void)initializeUserInterface;

@end

@implementation CYYHelpViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initializeUserInterface];
}

#pragma mark - responds event
- (void)respondsToLeftButton:(UIButton *)button{
    [[ControllerManager sharedManager].rootViewController popViewControllerAnimated:YES];
}

#pragma mark - private methods
- (void)initializeUserInterface{
    self.view.backgroundColor = COLOR_BackgroundGray;
    [self.view addSubview:self.guidScrollView];
    self.baseNavigationBar.backgroundColor = [UIColor whiteColor];
    self.bartitleLabel.text = @"帮助";
    [self.baseNavigationBar addSubview:self.leftNavButton];
    [self.leftNavButton setImage:[UIImage imageNamed:@"iconfont-zuojiantou"] forState:UIControlStateNormal];
    [self.leftNavButton addTarget:self action:@selector(respondsToLeftButton:) forControlEvents:UIControlEventTouchUpInside];
//    self.labelArray = [NSMutableArray array];
//    self.imageArray = [NSMutableArray array];
    for (int i = 0; i < 5; i ++) {
//        [self.labelArray addObject:[self haveLabelByIndex:i]];
        [self.guidScrollView addSubview:[self haveLabelByIndex:i]];
    }
    for (int i = 0; i < 11; i ++) {
//        [self.imageArray addObject:[self haveImageViewByIndex:i]];
        [self.guidScrollView addSubview:[self haveImageViewByIndex:i]];
    }
}

- (UILabel *)haveLabelByIndex:(NSInteger)index{
    NSArray * frameArray = @[[NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 0, 280, 40), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 540, 280, 40), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 1080, 280, 40), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 2190, 280, 40), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 3240, 280, 40), NO)]];
    UILabel * cLabel = [[UILabel alloc]init];
    cLabel.text = @[@"1、修改个人资料",@"2、查看历史活动",@"3、发起活动",@"4、查看有关活动",@"5、活动详情与评论"][index];
    cLabel.font = [UIFont boldSystemFontOfSize:20];
    cLabel.frame = [frameArray[index] CGRectValue];
    return cLabel;
}

- (UIImageView *)haveImageViewByIndex:(NSInteger)index{
    NSArray * frameArray = @[[NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 40, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 580, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 1120, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 1180, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 1690, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 2230, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 2740, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 3280, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 3790, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 4300, 280, 500), NO)],
                             [NSValue valueWithCGRect:DHFlexibleFrame(CGRectMake(20, 4810, 280, 500), NO)]];
    NSArray * imageNameArray = @[@"yyuser",@"yyhistory",@"yysponsor1",@"yysponsor2",@"yysponsor3",@"yyhome1",@"yyhome2",@"yydetail1",@"yydetail2",@"yycomment",@"yycall"];
    UIImageView * cImageView = [[UIImageView alloc]init];
    cImageView.frame = [frameArray[index] CGRectValue];
    cImageView.image = [UIImage imageNamed:imageNameArray[index]];
    return cImageView;
}

#pragma mark -getter
- (UIScrollView *)guidScrollView{
    if (!_guidScrollView) {
        _guidScrollView = ({
            UIScrollView * cScrollView = [[UIScrollView alloc]init];
            cScrollView.frame = DHFlexibleFrame(CGRectMake(0, 64, 320, 568 - 64), NO);
            cScrollView.contentSize = DHFlexibleSize(CGSizeMake(320, 5320), NO);
            cScrollView.showsHorizontalScrollIndicator = NO;
            cScrollView.bounces = NO;
            cScrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
            cScrollView;
        });
    }
    return _guidScrollView;
}

@end